<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.12.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>avalon: Connecter Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<script type="text/javascript" src="clipboard.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="cookie.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">avalon
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.12.0 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() { codefold.init(0); });
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search',false);
  $(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function(){ initResizable(false); });
/* @license-end */
</script>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>

</div><!-- top -->
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="class_connecter-members.html">List of all members</a>  </div>
  <div class="headertitle"><div class="title">Connecter Class Reference</div></div>
</div><!--header-->
<div class="contents">

<p>定义一个连接器类，用于建立和维护与消息队列服务器的连接  
 <a href="#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="connecter_8h_source.html">connecter.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-methods" name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a133e45342124deeab7b7be1dbe4b15f6" id="r_a133e45342124deeab7b7be1dbe4b15f6"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a133e45342124deeab7b7be1dbe4b15f6">Connecter</a> (int id, const std::string &amp;amqp_address)</td></tr>
<tr class="memdesc:a133e45342124deeab7b7be1dbe4b15f6"><td class="mdescLeft">&#160;</td><td class="mdescRight">构造函数，初始化连接器对象  <br /></td></tr>
<tr class="separator:a133e45342124deeab7b7be1dbe4b15f6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aead3ee0475b88557a6a98e58a0c2be00" id="r_aead3ee0475b88557a6a98e58a0c2be00"><td class="memItemLeft" align="right" valign="top"><a id="aead3ee0475b88557a6a98e58a0c2be00" name="aead3ee0475b88557a6a98e58a0c2be00"></a>
&#160;</td><td class="memItemRight" valign="bottom"><b>~Connecter</b> ()</td></tr>
<tr class="memdesc:aead3ee0475b88557a6a98e58a0c2be00"><td class="mdescLeft">&#160;</td><td class="mdescRight">析构函数，释放连接器对象 <br /></td></tr>
<tr class="separator:aead3ee0475b88557a6a98e58a0c2be00"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a51019cfe7a2587a2ca6941235876a0d2" id="r_a51019cfe7a2587a2ca6941235876a0d2"><td class="memItemLeft" align="right" valign="top"><a id="a51019cfe7a2587a2ca6941235876a0d2" name="a51019cfe7a2587a2ca6941235876a0d2"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>start</b> ()</td></tr>
<tr class="memdesc:a51019cfe7a2587a2ca6941235876a0d2"><td class="mdescLeft">&#160;</td><td class="mdescRight">启动连接器，开始连接消息队列服务器 <br /></td></tr>
<tr class="separator:a51019cfe7a2587a2ca6941235876a0d2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae5e5d065d1451410916fca8475d57058" id="r_ae5e5d065d1451410916fca8475d57058"><td class="memItemLeft" align="right" valign="top"><a id="ae5e5d065d1451410916fca8475d57058" name="ae5e5d065d1451410916fca8475d57058"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>run</b> ()</td></tr>
<tr class="memdesc:ae5e5d065d1451410916fca8475d57058"><td class="mdescLeft">&#160;</td><td class="mdescRight">运行事件循环，处理各种事件 <br /></td></tr>
<tr class="separator:ae5e5d065d1451410916fca8475d57058"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aea60e43d17860a3a85011795ca94aac6" id="r_aea60e43d17860a3a85011795ca94aac6"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#aea60e43d17860a3a85011795ca94aac6">setup</a> ()</td></tr>
<tr class="memdesc:aea60e43d17860a3a85011795ca94aac6"><td class="mdescLeft">&#160;</td><td class="mdescRight">设置连接器，包括建立到消息队列服务器的连接等  <br /></td></tr>
<tr class="separator:aea60e43d17860a3a85011795ca94aac6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2bb72edb16926086fd48eb4cb0737981" id="r_a2bb72edb16926086fd48eb4cb0737981"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a2bb72edb16926086fd48eb4cb0737981">notify</a> (int fd, short which)</td></tr>
<tr class="memdesc:a2bb72edb16926086fd48eb4cb0737981"><td class="mdescLeft">&#160;</td><td class="mdescRight">通知连接器有事件发生  <br /></td></tr>
<tr class="separator:a2bb72edb16926086fd48eb4cb0737981"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0924d067d995abaf1784d0befbbdc6d8" id="r_a0924d067d995abaf1784d0befbbdc6d8"><td class="memItemLeft" align="right" valign="top"><a id="a0924d067d995abaf1784d0befbbdc6d8" name="a0924d067d995abaf1784d0befbbdc6d8"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>reconnect</b> ()</td></tr>
<tr class="memdesc:a0924d067d995abaf1784d0befbbdc6d8"><td class="mdescLeft">&#160;</td><td class="mdescRight">重新连接消息队列服务器 <br /></td></tr>
<tr class="separator:a0924d067d995abaf1784d0befbbdc6d8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af39eff4ec5d147fb74ca49299f37f082" id="r_af39eff4ec5d147fb74ca49299f37f082"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#af39eff4ec5d147fb74ca49299f37f082">addProvider</a> (<a class="el" href="class_provider.html">Provider</a> *provider)</td></tr>
<tr class="memdesc:af39eff4ec5d147fb74ca49299f37f082"><td class="mdescLeft">&#160;</td><td class="mdescRight">添加一个消息提供者  <br /></td></tr>
<tr class="separator:af39eff4ec5d147fb74ca49299f37f082"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a54fa88894648d542cb425fc1a7905130" id="r_a54fa88894648d542cb425fc1a7905130"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a54fa88894648d542cb425fc1a7905130">addDeliver</a> (<a class="el" href="class_deliver.html">Deliver</a> *deliver)</td></tr>
<tr class="memdesc:a54fa88894648d542cb425fc1a7905130"><td class="mdescLeft">&#160;</td><td class="mdescRight">添加一个消息投递者  <br /></td></tr>
<tr class="separator:a54fa88894648d542cb425fc1a7905130"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>定义一个连接器类，用于建立和维护与消息队列服务器的连接 </p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="a133e45342124deeab7b7be1dbe4b15f6" name="a133e45342124deeab7b7be1dbe4b15f6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a133e45342124deeab7b7be1dbe4b15f6">&#9670;&#160;</a></span>Connecter()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">Connecter::Connecter </td>
          <td>(</td>
          <td class="paramtype">int</td>          <td class="paramname"><span class="paramname"><em>id</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const std::string &amp;</td>          <td class="paramname"><span class="paramname"><em>amqp_address</em></span>&#160;)</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">explicit</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>构造函数，初始化连接器对象 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">id</td><td>连接器的唯一标识符 </td></tr>
    <tr><td class="paramname">amqp_address</td><td>消息队列服务器的地址 </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a54fa88894648d542cb425fc1a7905130" name="a54fa88894648d542cb425fc1a7905130"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a54fa88894648d542cb425fc1a7905130">&#9670;&#160;</a></span>addDeliver()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Connecter::addDeliver </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="class_deliver.html">Deliver</a> *</td>          <td class="paramname"><span class="paramname"><em>deliver</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>添加一个消息投递者 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">deliver</td><td>消息投递者对象指针</td></tr>
  </table>
  </dd>
</dl>
<p>添加一个投递对象到连接器中</p>
<p>此函数用于将一个投递对象（Deliver）添加到连接器的投递对象列表中 它通过使用互斥锁来保护投递对象列表，以确保线程安全 在添加完成后，通过写入通知管道来唤醒等待的线程</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">deliver</td><td>指向要添加的投递对象的指针 </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="af39eff4ec5d147fb74ca49299f37f082" name="af39eff4ec5d147fb74ca49299f37f082"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af39eff4ec5d147fb74ca49299f37f082">&#9670;&#160;</a></span>addProvider()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Connecter::addProvider </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="class_provider.html">Provider</a> *</td>          <td class="paramname"><span class="paramname"><em>provider</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>添加一个消息提供者 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">provider</td><td>消息提供者对象指针</td></tr>
  </table>
  </dd>
</dl>
<p>在Connecter中添加一个Provider</p>
<p>此函数负责将一个Provider对象添加到Connecter的providers列表中，如果该Provider不存在。 它还会为Provider声明相应的交换机和队列，并绑定必要的回调函数来处理消息消费。</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">provider</td><td>指向要添加的Provider对象的指针 </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a2bb72edb16926086fd48eb4cb0737981" name="a2bb72edb16926086fd48eb4cb0737981"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2bb72edb16926086fd48eb4cb0737981">&#9670;&#160;</a></span>notify()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Connecter::notify </td>
          <td>(</td>
          <td class="paramtype">int</td>          <td class="paramname"><span class="paramname"><em>fd</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">short</td>          <td class="paramname"><span class="paramname"><em>which</em></span>&#160;)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>通知连接器有事件发生 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">fd</td><td>文件描述符 </td></tr>
    <tr><td class="paramname">which</td><td>事件类型</td></tr>
  </table>
  </dd>
</dl>
<p>Connecter类的notify方法，用于处理特定事件的通知。</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">fd</td><td>文件描述符，表示发生事件的文件或套接字。 </td></tr>
    <tr><td class="paramname">which</td><td>指定发生的事件类型，例如读或写事件。 </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="aea60e43d17860a3a85011795ca94aac6" name="aea60e43d17860a3a85011795ca94aac6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aea60e43d17860a3a85011795ca94aac6">&#9670;&#160;</a></span>setup()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool Connecter::setup </td>
          <td>(</td>
          <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>设置连接器，包括建立到消息队列服务器的连接等 </p>
<dl class="section return"><dt>Returns</dt><dd>成功返回true，否则返回false </dd></dl>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>E:/avalon/src/libavalon/<a class="el" href="connecter_8h_source.html">connecter.h</a></li>
<li>E:/avalon/src/libavalon/<b>connecter.cpp</b></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.12.0
</small></address>
</div><!-- doc-content -->
</body>
</html>
